use rand::Rng;
use std::cmp::Ordering;
use std::io;
fn main() {
    //println!("guessing！!");

    let secret_number = rand::thread_rng().gen_range(1..101);
    //println!("神秘数字是：{}" , secret_number);
    let x = '😂';
    let y = '😁';
    let z = '👍';
    println!("{}",y);
    loop {        
         println!("Guessing a number:");         
    let mut guess = String::new();

    io::stdin().read_line(&mut guess).expect("Err");

    let guess: u32 = match guess.trim().parse(){
        Ok(num) => num,
        Err(_) => continue,
    };
    println!("Guessing:{}",guess);

    match guess.cmp(&secret_number) {
        Ordering::Less => {
            println!("{}",x);
            println!( "Too small!");
        },
        Ordering::Greater => {
            println!("{}",x);
            println!("To big!");
        },
        Ordering::Equal => {
            println!("You win!");
            println!("{}",z);
        break;}
    }
    }
   
}

